package com.ehome.poct.terminal.api.constant;

import lombok.Getter;
import lombok.Setter;

public enum DeviceType {
    /**
     * 金标仪
     */
    JBY(1,"BA100"),
    /**
     * 血常规
     */
    BLOOD(2,"BA200"),
    /**
     * 荧光胶体金
     */
    COLLOIDAL(6,"BA300");

    DeviceType(Integer deviceType, String projectName) {
        this.deviceType = deviceType;
        this.projectName = projectName;
    }

    @Getter
    @Setter
    private Integer deviceType;
    @Getter
    @Setter
    private String projectName;

    public static DeviceType getDeviceTypeEnum(String projectName){
        for(DeviceType d :DeviceType.values()){
            if (d.getProjectName().equals(projectName)) {
                return d;
            }
        }
        return null;
    }

    public static Integer getDeviceType(String projectName){
         for(DeviceType d :DeviceType.values()){
             if (d.getProjectName().equals(projectName)) {
                 return d.getDeviceType();
             }
         }
         return null;
    }

    public static String getProjectName(Integer deviceType){
        for(DeviceType d :DeviceType.values()){
            if (d.getDeviceType().equals(deviceType)) {
                return d.getProjectName();
            }
        }
        return null;
    }
}
